package com.gzucm.Scholarship.common.enums;

import com.gzucm.Scholarship.exception.ParameterException;
import com.gzucm.Scholarship.exception.SwitchNotFoundException;

public enum ItemState {
    SAVED("已保存"),//学生填报后
    REVIEWED("已审核"),//班委通过后
    REFUSE("已拒绝"),//班委或学院审批不通过
    ADOPT("已通过");//学院通过后

    private String detail;

    ItemState(String detail) {
        this.detail = detail;
    }

    public String getDetail() {
        return detail;
    }

    public static ItemState get(Integer code) {
        switch (code) {
            case 1:
                return SAVED;
            case 2:
                return REVIEWED;
            case 3:
                return REFUSE;
            case 4:
                return ADOPT;
        }
        throw new ParameterException("不存在code为：" + code + " 的ItemState");
    }

    public Integer getCode(){
        switch (this) {
            case SAVED:
                return 1;
            case REVIEWED:
                return 2;
            case REFUSE:
                return 3;
            case ADOPT:
                return 4;
        }
        throw new SwitchNotFoundException(ItemState.class);
    }
}
